<?php
/*
 * @Description: 
 * @Author: huacong
 * @Date: 2021-12-27 21:39:15
 * @LastEditTime: 2021-12-29 21:31:55
 * @LastEditors: huacong
 */

namespace app\admin\controller;

class Controller
{

    public function index()
    {
        return 'hello';
    }
    /**
     * @description: 
     * @param  {*}
     * @return {*}
     * @param {int} $status
     * @param {string} $message
     * @param {array} $data
     */
    protected function renderJson(int $status = null, string $message = '', array $data = [])
    {
        return json(compact('status', 'message', 'data'));
    }

    public function renderSuccess($data = [], $message = 'success')
    {
        if (is_string($data)) {
            $message = $data;
            $data = [];
        }
        return $this->renderJson(config('status.success'), $message, $data);
    }
}
